package com.mayflygeek.mayflyask.framework.orm;

import java.util.Collection;

import com.googlecode.genericdao.search.Field;
import com.googlecode.genericdao.search.Filter;
import com.googlecode.genericdao.search.ISearch;
import com.googlecode.genericdao.search.Sort;

/**
 * @author 虫虫
 * @team 蜉蝣极客
 * @link www.mayflygeek.com
 * @Emial chongchong@mayflygeek.com
 * 
 */
public interface Query<T, RT> extends Resulted<RT>{
	Query<T, RT> searchClass(Class<T> searchClass);
	
	Query<T, RT> page(int page);
	
	Query<T, RT> page(int page, int pagesize);
	
	int thePage();
	
	Query<T, RT> pagesize(int pagesize);
	
	int pagesize();
	
	Query<T, RT> start(int firstResult);
	
	Query<T, RT> limit(int limit);
	
	Query<T, RT> start(int start, int limit);
	
	Query<T, RT> autoCount(boolean autoCount);
	
	boolean autoCount();
	
	Query<T, RT> filter(Filter filter);
	
	Query<T, RT> filters(Filter... filters);
	
	Query<T, RT> filterEqual(String property, Object value);
	
	Query<T, RT> filterGreaterOrEqual(String property, Object value);
	
	Query<T, RT> filterGreaterThan(String property, Object value);
	
	Query<T, RT> filterIn(String property, Collection<?> value);
	
	Query<T, RT> filterIn(String property, Object... value);
	
	Query<T, RT> filterNotIn(String property, Collection<?> value);
	
	Query<T, RT> filterNotIn(String property, Object... value);
	
	Query<T, RT> filterLessOrEqual(String property, Object value);
	
	Query<T, RT> filterLessThan(String property, Object value);
	
	Query<T, RT> filterLike(String property, String value);
	
	Query<T, RT> filterILike(String property, String value);
	
	Query<T, RT> filterNull(String property);
	
	Query<T, RT> filterNotNull(String property);
	
	Query<T, RT> filterEmpty(String property);
	
	Query<T, RT> filterNotEmpty(String property);
	
	Query<T, RT> filterAnd(Filter... filters);
	
	Query<T, RT> filterOr(Filter... filters);
	
	Query<T, RT> filterNot(Filter filter);
	
	Query<T, RT> filterSome(String property, Filter filter);
	
	Query<T, RT> filterAll(String property, Filter filter);
	
	Query<T, RT> filterNone(String property, Filter filter);
	
	Query<T, RT> removeFilter(Filter filter);
	
	Query<T, RT> removeFiltersOnProperty(String property);
	
	Query<T, RT> clearFilters();
	
	Query<T, RT> sort(Sort sort);
	
	Query<T, RT> sorts(Sort... sorts);
	
	Query<T, RT> sortAsc(String property);
	
	Query<T, RT> sortAsc(String property, boolean ignoreCase);
	
	Query<T, RT> sortDesc(String property);
	
	Query<T, RT> sortDesc(String property, boolean ignoreCase);
	
	Query<T, RT> sort(String property, boolean desc);
	
	Query<T, RT> sort(String property, boolean desc, boolean ignoreCase);
	
	Query<T, RT> removeSort(Sort sort);
	
	Query<T, RT> removeSort(String property);
	
	Query<T, RT> clearSorts();
	
	Query<T, RT> field(Field field);
	
	Query<T, RT> fields(Field... fields);
	
	Query<T, RT> field(String property, String key);
	
	Query<T, RT> field(String property, int operator);
	
	Query<T, RT> field(String property, int operator, String key);
	
	Query<T, RT> removeField(Field field);
	
	Query<T, RT> removeField(String property);
	
	Query<T, RT> removeField(String property, String key);
	
	Query<T, RT> clearFields();
	
	Query<T, RT> distinct(boolean distinct);
	
	Query<T, RT> resultMode(int resultMode);
	
	Query<T, RT> fetch(String property);
	
	Query<T, RT> fetches(String... propeties);
	
	Query<T, RT> removeFetch(String property);
	
	Query<T, RT> clearFetches();
	
	Query<T, RT> clear();
	
	Query<T,RT> clearPaging();
	
	ISearch toSearch();
}
